<?php
// include function files for this application
require_once('/home/domains/uny-con.com/public_html/uny-con_fns.php'); 
if(!session_id()) { session_start(); }

$old_user = $_SESSION['username'];  
// store  to test if they *were* logged in
setcookie(session_name() ,"",0,"/");
unset($_COOKIE[session_name()]);
$_SESSION = array();
session_unset();
$result_dest = session_destroy();

// start output html
do_html_header('Logging Out', staysmall, $uny);

if (!empty($old_user))
{
  if ($result_dest)
  {
    // if they were logged in and are now logged out
    echo 'Logged out.<br />';
    do_html_url('login.php', 'Login');
  }
  else
  {
   // they were logged in and could not be logged out
    echo 'Could not log you out.<br />';
  }
}
else
{
  // if they weren't logged in but came to this page somehow
  echo 'You were not logged in, and so have not been logged out.<br />';
  do_html_url('login.php', 'Login');
}

do_html_footer(news);

?>